import $ from '../../utils/ajax.js';
import util from '../../utils/util.js';
const app = getApp();
Page({
    data: {
        content: {},
        switch:true
    },
    onLoad(options) {
        
    },
    onShow() {
        this.getAccountInfoById();
    },
    getAccountInfoById() {
        $.p(app.wxApp.url + 'agentnew/getRoleInfoByToken', {}, app.onStrart, (res) => {
            const type = res.data.role
            if (type == 2 || type == 3 || type == 9) {
                this.setData({
                    switch:false
                })
            }else {
                this.setData({
                    switch: true
                })
            }
            this.setData({
                content: res.data
            })
            app.onShop();
        }, (res) => {
            util.showToast(res.data)
        })
    },
    omn(res) {
        if (typeof(this.time) === 'undefined' || (res.timeStamp - this.time > 1000)) {
            wx.navigateTo({
                url: '../' + res.currentTarget.dataset.path + '?is=' + JSON.stringify(this.data.countents)
            })
        }
        this.time = res.timeStamp;
    },
    onMack(){
        wx.makePhoneCall({
            phoneNumber: app.wxApp.tel
        })
    }
})